home *** CD-ROM | disk | FTP | other *** search
/ PC World 2007 June / PCWorld_2007-06_cd.bin / v cisle / pcwmultiboot / pcwMultiboot.exe / BootCD / MyBootCD / boot / scripts / keyinput.scr next >
Text File  |  2004-06-18  |  2KB  |  55 lines

  1. #
  2. # Sample script demonstrating keyboard input and logical action.
  3. # For CD Shell 2.0, Feb 2003
  4. #
  5.  
  6.  
  7. #--------------------------------------------------------------------------
  8. # Standard stuff...
  9. start: cls
  10. print "\n\n"
  11. print "Try pressing A, m, 9, tab, backspace, Ctrl-F4, F3, enter, "
  12. print "or escape (to quit).\n\n"
  13.  
  14.  
  15. #--------------------------------------------------------------------------
  16. # If no key is pressed in 5 seconds, we pretend the escape key was pressed.
  17.  
  18. getkey 5 set lastKey = key[esc]
  19.  
  20.  
  21. #--------------------------------------------------------------------------
  22. # Keys use the key[] function, which returns the keycode of that
  23. # key so that it may be compared with $lastKey
  24. #
  25. # You could also do some fancy stuff here like:
  26. # if $lastKey == key[B] || $lastKey == key[home]; then <blah, blah>
  27.  
  28. if $lastKey == key[A]; then print "A pressed."; then goto wait
  29. if $lastKey == key[m]; then print "m pressed."; then goto wait
  30. if $lastKey == key[9]; then print "9 pressed."; then goto wait
  31. if $lastKey == key[esc]; then print "Escape pressed.  You are finished!"; then goto nextScript
  32. if $lastKey == key[tab]; then print "Tab pressed."; then goto wait
  33. if $lastKey == key[back]; then print "Backspace pressed."; then goto wait
  34. if $lastKey == key[cf4]; then print "Ctrl-F4 pressed."; then goto wait
  35. if $lastKey == key[f3]; then print "F3 pressed."; then goto wait
  36. if $lastKey == key[enter]; then print "Enter pressed."; then goto wait
  37. print "Unknown key pressed! ($lastKey)"
  38.  
  39.  
  40. #--------------------------------------------------------------------------
  41. # Nothing new here...
  42.  
  43. wait:
  44. print "  Press any key..."
  45. getkey
  46. goto start
  47.  
  48.  
  49. #--------------------------------------------------------------------------
  50. # Check for the next sample script.
  51.  
  52. nextScript:
  53. if file[samples/variable.scr]; then script samples/variable.scr
  54. end
  55.